load("//bzl:cpp_library.bzl", "cpp_library")

package(default_visibility = ["//visibility:public"])

cpp_library(
    name = "lt_hash_internal",
    hdrs = [
        "LtHashInternal.h",
    ],
    deps = [
        "//folly:range",
    ],
)

cpp_library(
    name = "math_operation_simple",
    srcs = [
        "MathOperation_Simple.cpp",
    ],
    copts = select({
        "@platforms//cpu:x86_64": [
            "-mno-avx",
            "-mno-avx2",
            "-mno-sse2",
        ],
        "//conditions:default": [],
    }),
    deps = [
        ":lt_hash_internal",
        "//folly:memory",
        "//folly/lang:bits",
        "@glog",
    ],
)

cpp_library(
    name = "math_operation_sse2",
    srcs = [
        "MathOperation_SSE2.cpp",
    ],
    copts = select({
        "@platforms//cpu:x86_64": [
            "-mno-avx",
            "-mno-avx2",
            "-msse2",
        ],
        "//conditions:default": [],
    }),
    deps = [
        ":lt_hash_internal",
        "//folly:memory",
        "//folly/lang:bits",
        "@glog",
        "@libsodium",
    ],
)

cpp_library(
    name = "math_operation_avx2",
    srcs = [
        "MathOperation_AVX2.cpp",
    ],
    copts = select({
        "@platforms//cpu:x86_64": [
            "-mavx",
            "-mavx2",
            "-msse2",
        ],
        "//conditions:default": [],
    }),
    deps = [
        ":lt_hash_internal",
        "//folly:memory",
        "//folly/lang:bits",
        "@glog",
        "@libsodium",
    ],
)

cpp_library(
    name = "math_operation_sse2_disable",
    srcs = [
        "MathOperation_SSE2.cpp",
    ],
    copts = select({
        "@platforms//cpu:x86_64": [
            "-mno-avx",
            "-mno-avx2",
            "-mno-sse2",
        ],
        "//conditions:default": [],
    }),
    deps = [
        ":lt_hash_internal",
        "//folly:memory",
        "//folly/lang:bits",
        "@glog",
        "@libsodium",
    ],
)

cpp_library(
    name = "math_operation_avx2_disable",
    srcs = [
        "MathOperation_AVX2.cpp",
    ],
    copts = select({
        "@platforms//cpu:x86_64": [
            "-mno-avx",
            "-mno-avx2",
            "-mno-sse2",
        ],
        "//conditions:default": [],
    }),
    deps = [
        ":lt_hash_internal",
        "//folly:memory",
        "//folly/lang:bits",
        "@glog",
        "@libsodium",
    ],
)
